Skip to content

Stabilize Spanner integration tests and capture failure logs - #275

Closed
fforootd wants to merge 1 commit into
mainfrom
codex/stabilize-spanner-test
Closed

Stabilize Spanner integration tests and capture failure logs#275
fforootd wants to merge 1 commit into
mainfrom
codex/stabilize-spanner-test

Conversation

@fforootd

Copy link
Copy Markdown
Member

Summary

  • Make integration-test helper initialization safe for concurrent access in Spanner runs
  • Use per-test schema IDs to avoid shared schema collisions in flow definition tests
  • Remove the Spanner-only JSON schema skip so repository coverage matches the test matrix
  • Upload the Spanner integration test JSON log as a failure artifact in CI

Testing

  • Not run (not requested)

Copilot AI review requested due to automatic review settings June 12, 2026 18:28
@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nextgen Ready Ready Preview, Comment Jun 12, 2026 6:29pm

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to make the Go Spanner integration test matrix more stable and diagnosable by hardening integration-test harness initialization for concurrency, reducing schema-collision flakiness in flow definition tests, and preserving failure logs as CI artifacts.

Changes:

  • Remove the Spanner-specific skip for JSON schema repository CRUD tests so Spanner coverage matches Postgres.
  • Make integration-test harness lazy initialization concurrency-safe and adjust flow definition tests to use per-test schema IDs (and reduce intra-package parallelism).
  • Capture go test -json output for Spanner integration tests and upload it as a CI artifact on failure.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/storage/database/repository/json_schema_test.go Removes Spanner-only skip to run JSON schema CRUD tests on Spanner.
internal/api/integration_test/helpers/user.go Adds mutex-guarded lazy init for user service/repo.
internal/api/integration_test/helpers/user_password.go Adds mutex-guarded lazy init for user password repo.
internal/api/integration_test/helpers/user_passkey.go Adds mutex-guarded lazy init for user passkey repo.
internal/api/integration_test/helpers/team.go Adds mutex-guarded lazy init for team repo/service.
internal/api/integration_test/helpers/spanner_database.go Adds mutex-guarded lazy init for Spanner DB pool.
internal/api/integration_test/helpers/session.go Adds mutex-guarded lazy init for session service/repo.
internal/api/integration_test/helpers/server.go Adds mutex-guarded lazy init for generated server/test server/handlers.
internal/api/integration_test/helpers/secrets.go Adds mutex-guarded lazy init for secret generator.
internal/api/integration_test/helpers/schema.go Adds mutex-guarded lazy init for schema components; introduces “ensure schema exists” helpers and schema-ID helpers.
internal/api/integration_test/helpers/project.go Adds mutex-guarded lazy init for project repo/service.
internal/api/integration_test/helpers/pg_database.go Adds mutex-guarded lazy init for Postgres DB pool.
internal/api/integration_test/helpers/http_client.go Adds mutex-guarded lazy init for shared HTTP client.
internal/api/integration_test/helpers/harness.go Introduces mutexes on Harness for safe concurrent initialization.
internal/api/integration_test/helpers/flow.go Adds mutex-guarded lazy init for flow service/state machine/repo.
internal/api/integration_test/helpers/flow_definition.go Adds mutex-guarded lazy init for flow definition service.
internal/api/integration_test/helpers/crypto.go Makes hasher/crypter initialization concurrency-safe and reuses a shared hasher instance.
internal/api/integration_test/helpers/client.go Makes API client and security source maps concurrency-safe.
internal/api/integration_test/helpers/auth_attempt.go Adds mutex-guarded lazy init for auth attempt service/repo.
internal/api/integration_test/flow_definition_test.go Removes t.Parallel() usage and switches to per-test schema IDs to avoid collisions.
.github/workflows/ci.yml Runs Spanner integration tests with -json output and uploads the log artifact on failure.
.changeset/spanner-test-stability.md Adds an empty changeset for a non-release change.

Comment on lines 12 to +29
func (h *Harness) EnsureTestServer(t *testing.T) *httptest.Server {
t.Helper()
h.mu.Lock()
server := h.TestServer
h.mu.Unlock()
if server != nil {
return server
}
server = httptest.NewServer(
h.EnsureGeneratedServer(t),
)
h.mu.Lock()
if h.TestServer == nil {
h.TestServer = httptest.NewServer(
h.EnsureGeneratedServer(t),
)
h.TestServer = server
}
return h.TestServer
server = h.TestServer
h.mu.Unlock()
return server
Comment on lines 14 to 32
func (h *Harness) EnsureDBPool(t *testing.T) database.Pool {
t.Helper()

h.mu.Lock()
pool := h.DBPool
h.mu.Unlock()
if pool != nil {
return pool
}
pool, err := Connector.Connect(t.Context())
require.NoError(t, err)
h.mu.Lock()
if h.DBPool == nil {
var err error
h.DBPool, err = Connector.Connect(t.Context())
require.NoError(t, err)
h.DBPool = pool
}
return h.DBPool
pool = h.DBPool
h.mu.Unlock()
return pool
}
Comment on lines 14 to 32
func (h *Harness) EnsureDBPool(t *testing.T) database.Pool {
t.Helper()

h.mu.Lock()
pool := h.DBPool
h.mu.Unlock()
if pool != nil {
return pool
}
pool, err := Connector.Connect(t.Context())
require.NoError(t, err)
h.mu.Lock()
if h.DBPool == nil {
var err error
h.DBPool, err = Connector.Connect(t.Context())
require.NoError(t, err)
h.DBPool = pool
}
return h.DBPool
pool = h.DBPool
h.mu.Unlock()
return pool
}
@fforootd fforootd closed this Jun 12, 2026
@fforootd
fforootd deleted the codex/stabilize-spanner-test branch June 16, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants